﻿using DocumentFormat.OpenXml.Lite.Shared;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Chart.Elements
{
    [XmlRoot("", Namespace = Constants.Chart)]
    public class Value : XmlSerializable
    {
        [XmlElement("", Namespace = Constants.Chart)]
        public IChartValueElement Val { get; set; }

        public Value() { }
    }

    [XmlRoot("numRef", Namespace = Constants.Chart)]
    public class NumberReference : XmlSerializable, IChartValueElement, ICategoryElement
    {
        [XmlElement("f", Namespace = Constants.Chart)]
        public SimpleText Formula { get; set; }

        [Optional]
        [XmlElement("numCache", Namespace = Constants.Chart)]
        public NumberLiteral NumberCache { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.Chart)]
        public ExtensionList ExtensionList { get; set; }

        public NumberReference() { }
    }

    [XmlRoot("numLit", Namespace = Constants.Chart)]
    public class NumberLiteral : XmlSerializable, IChartValueElement, ICategoryElement
    {
        [Optional]
        [XmlElement("formatCode", Namespace = Constants.Chart)]
        public SimpleText FormatCode { get; set; }

        [Optional]
        [XmlElement("ptCount", Namespace = Constants.Chart)]
        public RequiredValue<uint> PointCount { get; set; }

        [Optional]
        [XmlElement("pt", Namespace = Constants.Chart)]
        public XmlList<Point> Points { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.Chart)]
        public ExtensionList ExtensionList { get; set; }

        public NumberLiteral() 
        {
            Points = new XmlList<Point>();
        }
    }
}
